package com.odianyun.hello.Utils;
import java.util.Random;
/**
 *  用于生产各种各样的ID
 */
public class IdUtils {
    public String getRentId() {
        //取当前时间的长整形值包含毫秒
        long millis = System.currentTimeMillis();
        //long millis = System.nanoTime();
        //加上两位随机数
        Random random = new Random();
        int end2 = random.nextInt(99);
        //如果不足两位前面补0
        String str = millis + String.format("%02d", end2);
        String id = new String(str);
        return id;
    }
}